#global variables
maxhunt = 0
nohunters = 0
rewarded = False

def hunt_choices(round_number, current_food, current_reputation, m,
            player_reputations):

    #import the global variables
    global maxhunt
    global hunters
    global rewarded
    
    if round_number == 1: #chose to be hunter in all hunts
            return ['h']*len(player_reputations)
    #check if the number of hunters in the previous round are more than or equal m or less than m
    exc_m = bool(hunters >= m )
    if exc_m or rewarded: #if the number of hunters is more than m or we take the award that contains alot of food
            maxhunt = max((current_food/3)-(len(player_reputations)-1),0)#
    else: #else we decrease the value of maximum numbers of hunts 
            maxhunt = max((current_food/6)-(len(player_reputations)-1),0)
    if maxhunt == 0: #chose to be slacker in all hunts
            return ['s']*len(player_reputations)
    hunt_decisions = []
    hunts = 0 
    for x in range(len(player_reputations)):
        if hunts <= maxhunt: #we can make hunts
            if player_reputations[x] > 0.5 or (player_reputations[x] == 0.5 and exc_m):
                #if the number of hunts made by the player is more than 0.5 
                #or equals 0.5 and the number of hunters in the previous round more than or equal m
                hunt_decisions += ['h'] #hunt because that player is hunting more than slacking
                hunts += 1 #add one to that variable to count the number of hunts i made
            else :
                hunt_decisions += ['s'] #slack because that player is slacking more than hunting
        else:
            hunt_decisions += ['s'] #slacks because i have small amount of food
    return hunt_decisions #hunting decisions

def hunt_outcomes(food_earnings):
    pass # do nothing

def round_end(award, m, number_hunters):
    
    #import the global variables
    global nohunters
    global rewarded
    nohunters = hunters #to get the number of hunters in the round
    rewarded = bool(award != 0) #to know if we reawarded or not
